package y23.Aug;

public class Test3 {
    //https://www.nowcoder.com/share/jump/5867789821692876376590
    //牛客 NC141 判断是否为回文字符串
    public static boolean judge (String str) {
        int left = 0;
        int right = str.length() - 1;
        while(left < right){
            if(str.charAt(left) != str.charAt(right)){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }

    public static void main(String[] args) {
        String s1 = "absba";
        String s2 = "ranko";
        String s3 = "yamatomaya";
        String s4 = "a";
        System.out.println(judge (s1));
        System.out.println(judge (s2));
        System.out.println(judge (s3));
        System.out.println(judge (s4));
    }
}
